package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/13 21:51
 **/
public class Offer14 {
    class Solution {
        public int cuttingRope(int n) {
            if(n < 4) return n == 1 ? 1 : n-1;
            int ans = 1;
            while(n > 4){
                ans *= 3;
                n -= 3;
            }
            return ans * n;
        }
    }
}